package com.hzw.video.extractor

import android.media.MediaFormat
import java.nio.ByteBuffer

/**
 *
 * @Author:         HuaZhongWei
 * @CreateDate:     2020/9/16 9:45
 *
 * @Description:    视频提取器
 *
 */
class VideoExtractor(path: String) : IExtractor {

    private val extractor = MMExtractor(path)

    override fun getFormat(): MediaFormat? = extractor.getVideoFormat()

    override fun readBuffer(byteBuffer: ByteBuffer): Int = extractor.readBuffer(byteBuffer)

    override fun getCurrentTimestamp(): Long = extractor.currentSampleTime

    override fun seek(pos: Long): Long = extractor.seek(pos)

    override fun setStartPos(pos: Long) {
        extractor.startPos = pos
    }

    override fun stop() = extractor.stop()

    override fun getTrack(): Int = extractor.videoTrack

    override fun getSampleFlag(): Int = extractor.getSampleFlag()
}